//
//  BQBuyCarViewController.m
//  BeeQuick
//
//  Created by mac on 16/11/18.
//  Copyright © 2016年 six_group. All rights reserved.
//

#import "BQBuyCarViewController.h"
#import "CZAdditions.h"
@interface BQBuyCarViewController ()


@end

@implementation BQBuyCarViewController

- (void)viewDidLoad {
    [super viewDidLoad];

//    if(模型为空)
//    {
//          [self setupEmptyUI];
//    }
//    else
//    {
    [self setupMainUI];
//    }
    
    
  
    
}

#pragma mark - 搭建UI界面
- (void)setupEmptyUI
{
    self.navigationItem.title = @"购物车";

    
    UIImageView * midImg = [[UIImageView alloc]init];
    self.view.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
    
    [self.view addSubview:midImg];
    
    midImg.image = [UIImage imageNamed:@"v2_shop_empty"];
    
    [midImg sizeToFit];
    
    [midImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.centerY.equalTo(self.view).offset(-50);
    }];

    
    UILabel *label = [[UILabel alloc]init];
    
    label.text = @"亲,购物车空空的耶~赶紧的去挑好吃的把";
//    [label sizeToFit];
    [self.view addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(midImg.mas_bottom).offset(30);
    }];
    
    label.textColor = [UIColor cz_colorWithHex:0x878383];
    
    
    UIButton * btn = [[UIButton alloc]init];
    [btn setTitle:@"去逛逛吧" forState:UIControlStateNormal];
    
    [btn setTitleColor:[UIColor cz_colorWithHex:0x646464] forState:UIControlStateNormal];
    
    [self.view addSubview:btn];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(label.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(180, 30));
    }];
    
//给按钮切割圆角
    btn.layer.cornerRadius = 10;
    
//    btn.titleLabel.textColor = [UIColor cz_colorWithHex:0x646464];
//    btn.tintColor = [UIColor cz_colorWithHex:0x646464];
    
    //MARK: - 给按钮一个点击事件.
    [btn addTarget:self action:@selector(goShoping:) forControlEvents:UIControlEventTouchUpInside];
    
    btn.layer.borderWidth = 1.0;
    btn.layer.borderColor = [UIColor cz_colorWithHex:0x646464].CGColor;//记得转成C的

    
  
}


- (void)setupMainUI
{
    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
    
    [self.view addSubview:tableView];
    
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    

    
    
    
}


#pragma mark - 去逛逛按钮的点击事件
- (void)goShoping:(UIButton *)btn
{
    NSLog(@"我准备去逛一逛");
    //跳转到首页 -- 使用通知
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"goShoping" object:nil];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
